package com.ly.datacenter.component.pager.pojo;
/**
 * function：
 * @author watson  email: watson.wu@hotmail.com
 * @date 2009-9-7
 */
public class MySQLPagination {
	
	public static String getPaginationSql(String sql, int page, int pagesize) {
		StringBuffer pagingQuery = new StringBuffer(sql);
		int startIndex = (page-1) * pagesize;
		int endIndex = page * pagesize-1;
		pagingQuery.append(" limit(").append(startIndex).append(",").append(endIndex).append(" )");
		return pagingQuery.toString();
	}

	public static void getPaginationSql(StringBuffer sql, int page, int pagesize) {
		int startIndex = (page-1) * pagesize;
		int endIndex = page * pagesize-1;
		sql.append(" limit ").append(startIndex).append(",").append(endIndex).append(" ");
	}

}

